{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import utils\n",
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "import seaborn as sns\n",
    "from scipy import sparse"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "encoder = utils.ClaimEncoder()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "matrix = encoder.tokenize_claim(\"hello my name\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [],
   "source": [
    "matrix = sparse.vstack(matrix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "import joblib"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [],
   "source": [
    "feature_encoder = joblib.load(\"feature_encoder.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[    0,     0],\n",
       "       [    1,   638],\n",
       "       [    1, 10259],\n",
       "       [    1, 12846],\n",
       "       [    1, 16593],\n",
       "       [    1, 16671],\n",
       "       [    2,   843],\n",
       "       [    2, 17978],\n",
       "       [    3,   638],\n",
       "       [    3, 10259],\n",
       "       [    3, 12846],\n",
       "       [    3, 16593],\n",
       "       [    3, 16671],\n",
       "       [    4,   843],\n",
       "       [    4, 17978],\n",
       "       [    5,   856],\n",
       "       [    5,  6324],\n",
       "       [    5, 17337],\n",
       "       [    5, 18213],\n",
       "       [    6,   843],\n",
       "       [    6, 17978],\n",
       "       [    7,   856],\n",
       "       [    7,  6324],\n",
       "       [    7, 17337],\n",
       "       [    7, 18213],\n",
       "       [    8,     0]])"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.argwhere(matrix.todense())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[    0,     0],\n",
       "       [    1,   638],\n",
       "       [    1, 10259],\n",
       "       [    1, 12846],\n",
       "       [    1, 16593],\n",
       "       [    1, 16671],\n",
       "       [    2,     0]])"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix = encoder.tokenize_claim(\"Hello\")\n",
    "matrix = sparse.vstack(matrix)\n",
    "np.argwhere(matrix.todense())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "import nltk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('#', ' ', 'h'),\n",
       " (' ', 'h', 'e'),\n",
       " ('h', 'e', 'l'),\n",
       " ('e', 'l', 'l'),\n",
       " ('l', 'l', 'o'),\n",
       " ('l', 'o', ' '),\n",
       " ('o', ' ', 'm'),\n",
       " (' ', 'm', 'y'),\n",
       " ('m', 'y', ' '),\n",
       " ('y', ' ', 'n'),\n",
       " (' ', 'n', 'a'),\n",
       " ('n', 'a', 'm'),\n",
       " ('a', 'm', 'e'),\n",
       " ('m', 'e', ' '),\n",
       " ('e', ' ', '#')]"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(nltk.ngrams(\"# hello my name #\", 3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[    0,     0],\n",
       "       [    1,   638],\n",
       "       [    1, 10259],\n",
       "       [    1, 12846],\n",
       "       [    1, 16593],\n",
       "       [    1, 16671],\n",
       "       [    2,     0]])"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix = sparse.vstack(matrix)\n",
    "np.argwhere(matrix.todense())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAADU9JREFUeJzt3GGI5Hd9x/H3xztTaYym9FaQu9Ok9NJ42ELSJU0Raoq2XPLg7oFF7iBYJXhgGylVhBRLlPjIhloQrtWTilXQGH0gC57cA40ExAu3ITV4FyLb03oXhawxzZOgMe23D2bSna53mX92Z3cv+32/4GD+//ntzJcfe++dndmZVBWSpO3vFVs9gCRpcxh8SWrC4EtSEwZfkpow+JLUhMGXpCamBj/JZ5M8meT7l7g+ST6ZZCnJo0lunP2YkqT1GvII/3PAgRe5/lZg3/jfUeBf1j+WJGnWpga/qh4Efv4iSw4Bn6+RU8DVSV4/qwElSbOxcwa3sRs4P3F8YXzup6sXJjnK6LcArrzyyj+8/vrrZ3D3ktTHww8//LOqmlvL184i+INV1XHgOMD8/HwtLi5u5t1L0stekv9c69fO4q90ngD2ThzvGZ+TJF1GZhH8BeBd47/WuRl4pqp+7ekcSdLWmvqUTpIvAbcAu5JcAD4CvBKgqj4FnABuA5aAZ4H3bNSwkqS1mxr8qjoy5foC/npmE0mSNoTvtJWkJgy+JDVh8CWpCYMvSU0YfElqwuBLUhMGX5KaMPiS1ITBl6QmDL4kNWHwJakJgy9JTRh8SWrC4EtSEwZfkpow+JLUhMGXpCYMviQ1YfAlqQmDL0lNGHxJasLgS1ITBl+SmjD4ktSEwZekJgy+JDVh8CWpCYMvSU0YfElqwuBLUhMGX5KaMPiS1ITBl6QmDL4kNWHwJamJQcFPciDJ40mWktx1kevfkOSBJI8keTTJ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KsmBTZtucw3Zi48Ctye5AJwA3r85o112XmpPgE3+aAUNk+R2YB5461bPshWSvAL4BPDuLR7lcrGT0dM6tzD6re/BJL9fVf+1pVNtjSPA56rqH5P8MaP3/7y5qv5nqwd7OdjoR/h+LMOKIXtBkrcDHwYOVtUvN2m2zTZtL64C3gx8O8mPGD1HubBNX7gd8n1xAVioql9V1Q+BHzD6AbDdDNmLO4D7Aarqu8CrGH2wWjeDerLaRgffj2VYMXUvktwAfJpR7Lfr87QwZS+q6pmq2lVV11TVNYxezzhYVWv+0KjL2JD/I19j9OieJLsYPcVzbjOH3CRD9uLHwNsAkryJUfCXN3XKy8MC8K7xX+vcDDxTVT+d9kUb+pRObdzHMrzsDNyLe4FXA18Zv27946o6uGVDb5CBe9HCwL04Cfx5krPAfwMfqqpt91vwwL34IPCZJH/L6AXcd2/HB4hJvsToh/yu8esVHwFeCVBVn2L0+sVtwBLwLPCeQbe7DfdKknQRvtNWkpow+JLUhMGXpCYMviQ1YfAlqQmDL0lNGHxJauJ/Acz2XLpusNoKAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots(1, 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(69, 29244)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "matrix.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.lines.Line2D at 0x7feac43e2a20>"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ax.spy(matrix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig.savefig(\"testing.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAAmCAYAAADHhSDvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAABmVJREFUeJztnV2oFVUUx39/My1KS/NWYlHax4MUlFn5UBIRVj5kQYH2oFQQRUU99GD40ksPCX0QRVEUZERmX9iLpIbQk5q3TL2JeTWxLpbah0aRfa0e9hobLufc6+mMZ86dWT8YZs/aezb7P2ufdWb27LOPzIwgCIKg+owquwFBEARBZ4iAHwRBUBMi4AdBENSECPhBEAQ1IQJ+EARBTYiAHwRBUBO6JuBLuknSDkn9khaX3Z5WkbRH0lZJmyVtcttESWsk7fT9BLdL0nOudYukGbl6Fnn5nZIWlaXH2/KapP2StuVshWmSdIVfs34/V51V2FTj45IG3JebJc3N5T3m7d0h6cacvWH/lTRV0ga3vy1pTOfUHW3DuZLWSfpSUp+kh91eGV8OobFSvmwbMyt9A04AdgHTgDHAF8D0stvVooY9wKRBtqXAYk8vBp709FxgFSBgFrDB7ROB3b6f4OkJJWqaDcwAth0PTcBGLys/9+Yu0fg48GiDstO9b44FpnqfPWGo/gusAOZ7+iXg/hI0TgZmeHoc8JVrqYwvh9BYKV+2u3XLHf5VQL+Z7TazP4DlwLyS21QE84DXPf06cGvOvswS64HTJU0GbgTWmNmPZvYTsAa4qdONzjCzT4AfB5kL0eR5481svaVP0LJcXR2jicZmzAOWm9kRM/sa6Cf13Yb91+9yrwfe9fPz16tjmNk+M/vM078A24EpVMiXQ2hsxoj0Zbt0S8CfAnyTO/6WoZ3VjRiwWlKvpHvddpaZ7fP0d8BZnm6mdyRch6I0TfH0YHu38KAPZ7yWDXXQusYzgJ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QP+MTDN91N9b/y32twjpLv7LODPB+7Mn2xms7K0pE1Hfjs0s4A2dS2SNplZpTVCPXSGxmpQB40ZbQV8SbeRhm4g/R0YpPH8g6S/HLvcjyF9Eawwsz6CIAiCjtPuLJ0PSOPyRzIT6cXtJcB9/BfsAa41sycIgiAISqHtIR0zW0WagjmYl31rhVbLj0TqoBHqoTM0VoM6aASOYZZOEARBUA1iLZ0gCIKaEAE/CIKgJkTAD4IgqAkR8IMgCGpCBPwgCIKaEAE/CIKgJkTAD4IgqAn/AgulKkkEr6zaAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fig"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.spy(matrix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_coo_matrix(m):\n",
    "    if not isinstance(m, sparse.coo_matrix):\n",
    "        m = sparse.coo_matrix(m)\n",
    "    fig = plt.figure()\n",
    "    ax = fig.add_subplot(111, facecolor='black')\n",
    "    ax.plot(m.col, m.row, 's', color='white', ms=1)\n",
    "    ax.set_xlim(0, m.shape[1])\n",
    "    ax.set_ylim(0, m.shape[0])\n",
    "    ax.set_aspect('equal')\n",
    "    for spine in ax.spines.values():\n",
    "        spine.set_visible(False)\n",
    "    ax.invert_yaxis()\n",
    "    ax.set_aspect('equal')\n",
    "    ax.set_xticks([])\n",
    "    ax.set_yticks([])\n",
    "    return ax"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ax = plot_coo_matrix(matrix)\n",
    "ax.figure.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "matrix.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "matrix = np.vstack([i.todense() for i in matrix])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "matrix.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "shape = (100000, 100000)\n",
    "rows = np.int_(np.round_(shape[0]*np.random.random(1000)))\n",
    "cols = np.int_(np.round_(shape[1]*np.random.random(1000)))\n",
    "vals = np.ones_like(rows)\n",
    "\n",
    "m = sparse.coo_matrix((vals, (rows, cols)), shape=shape)\n",
    "ax = plot_coo_matrix(m)\n",
    "ax.figure.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
